package top.yfq.shortlinkweb.util;

import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;

/**
 * @author yfq
 * @date 2025/7/18 18:03
 * @description
 */
@Component
public class ShortCodeGenerator {
    @Resource
    private IdSegmentGenerator idSegmentGenerator;

    /**
     * 获取短链码
     */
    public String getShortCode() {
        long id = idSegmentGenerator.nextId();
        return Base62Encoder.encode(id);
    }
}
